import seaborn as sns
import matplotlib.pyplot as plt
from matplotlib.figure import Figure

def comsumption_fig(consumption_data: dict) -> Figure:
    comsumption_fig, ax = plt.subplots(1, 1, figsize=(13, 7))
    sns.lineplot(x=consumption_data['ym'], y=-consumption_data['MonDeal'], ax=ax)
    ax.set_title("月度平均消费")
    ax.set_xlabel("月份")
    ax.set_ylabel("平均消费(元)")
    return comsumption_fig

def consumption_predict_fig(predict_cnsumption: dict) -> Figure:
    consumption_predict_fig, ax = plt.subplots(1, 1, figsize=(13, 7))
    sns.scatterplot(predict_cnsumption, x="日期", y='消费金额（元）', ax=ax)
    ax.set_title("消费预测")
    last_point = predict_cnsumption.iloc[-1]
    ax.scatter(last_point['日期'], last_point['消费金额（元）'], color='red', s=100)
    return consumption_predict_fig